package com.baizhi.controller;

import com.baizhi.feign.GoodsServiceFeign;
import com.baizhi.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@CrossOrigin
@RestController
@RequestMapping("/backend/user")
public class UserController {

    @Autowired
    GoodsServiceFeign userService;

    /**
     * 登录
     * @param user
     * @return
     */
    @RequestMapping(value = "login")
    public String login(@RequestBody User user){
        User users= userService.login(user);
        if (users != null){
            if (users.getRole().equals("运营角色")){
                return "2"+users.getUsername();
            }else {
                return "3"+users.getUsername();
            }
        }
        return "1";
    }
}
